﻿using log4net.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;

namespace ComTools.Controller
{
    public class ReceiveController : ApiController
    {
        log4net.ILog logger = log4net.LogManager.GetLogger("ReceiveController");

        [Route("erp/out")]
        [HttpGet]
        public IHttpActionResult get()
        {
            return Json<object>(new
            {
                state = true,
                msg = "OK"
            });
        }

        [Route("erp/out")]
        [HttpPost]
        public IHttpActionResult post(object objJson)
        {
            logger.Error(objJson.ToString());

            return Json<object>(new
            {
                msg = "操作成功",
                code = 0
            });
        }


    }


    public class PostEntityHead
    {
        /// <summary>
        /// 客户地址
        /// </summary>
        public string addressName { get; set; }
        /// <summary>
        /// 客户名称
        /// </summary>
        public string custName { get; set; }
        /// <summary>
        /// 单据类型(7.标准出货 8.材料出货单 9.杂发单 10.调出单)    必填
        /// </summary>
        public int docType { get; set; }
        /// <summary>
        /// erp单号 必填
        /// </summary>
        public string erpDocNo { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        public string erpStatus { get; set; }
        /// <summary>
        ///  电话
        /// </summary>
        public string phoneName { get; set; }
        /// <summary>
        /// 联系人	
        /// </summary>
        public string receiveName { get; set; }
        /// <summary>
        /// 组织代号 必填
        /// </summary>
        public string ownerCode { get; set; }
        /// <summary>
        /// 组织名称
        /// </summary>
        public string ownerName { get; set; }
    }

    public class PostEntityLine
    {
        /// <summary>
        /// 行号  必填
        /// </summary>
        public string lineNo { get; set; }
        /// <summary>
        /// decimal (24, 9)	数量 必填
        /// </summary>
        public decimal itemNum { get; set; }
        /// <summary>
        /// 料号编码 必填
        /// </summary>
        public string itemCode { get; set; }
        /// <summary>
        /// 料号描述
        /// </summary>
        public string itemDesc { get; set; }
        /// <summary>
        /// 料号名称
        /// </summary>
        public string itemName { get; set; }
        /// <summary>
        /// 料号规格
        /// </summary>
        public string itemSpec { get; set; }
        /// <summary>
        /// 料号单位
        /// </summary>
        public string itemUnitCode { get; set; }
        /// <summary>
        /// 项目号 非必填
        /// </summary>
        public string projectId { get; set; }
        /// <summary>
        /// 项目名称
        /// </summary>
        public string projectName { get; set; }
        /// <summary>
        /// 仓库编码
        /// </summary>
        public string positionCode { get; set; }
        /// <summary>
        /// 仓库名称
        /// </summary>
        public string positionName { get; set; }

    }


    public class PostEntity
    {
        public PostEntityHead head { get; set; }
        public List<PostEntityLine> detail { get; set; }
    }
}